﻿#region COPYRIGHT© 2009-2013 Phillip Clark. All rights reserved.

// For licensing information see License.txt (MIT style licensing).

#endregion

using System.Collections.Generic;

namespace FlitBit.Json
{
	public sealed class JsonMemberArray : JsonMember
	{
		public JsonMemberArray(string name, JsonArray value)
			: base(name, value)
		{}

		public override int Count
		{
			get
			{
				var arr = base.Value as JsonArray;
				return arr.Count;
			}
		}

		public override bool IsReadOnly { get { return false; } }

		public override void Add(JsonValue item)
		{
			var arr = base.Value as JsonArray;
			arr.Add(item);
		}

		public override void Clear()
		{
			var arr = base.Value as JsonArray;
			arr.Clear();
		}

		public override bool Contains(JsonValue item)
		{
			var arr = base.Value as JsonArray;
			return arr.Contains(item);
		}

		public override void CopyTo(JsonValue[] array, int arrayIndex)
		{
			var arr = base.Value as JsonArray;
			arr.CopyTo(array, arrayIndex);
		}

		public override IEnumerator<JsonValue> GetEnumerator()
		{
			var arr = base.Value as JsonArray;
			return arr.GetEnumerator();
		}

		public override bool Remove(JsonValue item)
		{
			var arr = base.Value as JsonArray;
			return arr.Remove(item);
		}
	}
}